package com.wzy.scns.repositery;

import com.wzy.scns.entity.Student;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Repository
public interface StudentRepository extends JpaRepository<Student,Integer> {
    Student getStudentByNameAndPassword(String name,String password);
    Student getStudentByCodeAndPassword(String code,String password);
    Student findByName(String name);
    @Transactional
    int deleteStudentByCode(String code);
    Student findByCodeAndIdIsNot(String code,Integer id);
    Student findByNameAndIdIsNot(String name,Integer id);

    Student getStudentById(Integer id);
    Student getStudentByCode(String code);

    Student findByCode(String code);

}
